from flask_restful import Api
from flask import jsonify
from . import main_api
from .departmentResource import DepartmentResource
from .downloadResource import download_file
from .employeeResource import EmployeeResource
from .newspaperResource import NewspaperResource
from .orderResource import OrderResource
from .utilResource import UtilResource
from .userResource import UserResource
api = Api(main_api)


@main_api.route("/test", methods=["GET", "POST"], endpoint='test')
def test():
    return jsonify(message="测试成功！")


@main_api.route("/login", methods=["GET", "POST"], endpoint='login')
def login():
    return UserResource.login()


@main_api.route("/register", methods=["GET", "POST"], endpoint='register')
def register():
    return UserResource.register()


@main_api.route("/change_password", methods=["GET", "POST"], endpoint='change_password')
def change_password():
    return UserResource.change_password()


@main_api.route("/get_department_person_statistics", methods=['GET'], endpoint="get_department_person_statistics")
def get_department_person_statistics():
    return DepartmentResource.get_department_person_statistics()


@main_api.route("/get_person_order_statistics", methods=['GET'], endpoint="get_person_order_statistics")
def get_person_order_statistics():
    return EmployeeResource.get_person_order_statistics()


@main_api.route("/get_order_department_statistics", methods=['GET'], endpoint="get_order_department_statistics")
def get_order_department_statistics():
    return DepartmentResource.get_order_department_statistics()


@main_api.route("/get_department_order_statistics", methods=['GET'], endpoint="get_department_order_statistics")
def get_department_order_statistics():
    return OrderResource.get_department_order_statistics()


@main_api.route("/export_data_to_csv", methods=['GET', 'POST'], endpoint="export_data_to_csv")
def export_data_to_csv():
    return UtilResource.export_data_to_csv()


@main_api.route("/get_employee_all_data", methods=['GET'], endpoint="get_employee_all_data")
def get_employee_all_data():
    return EmployeeResource.get_employee_all_data()


@main_api.route("/add_employee_info", methods=['POST'], endpoint="add_employee_info")
def add_employee_info():
    return EmployeeResource.add_employee_info()


@main_api.route("/delete_employee_info", methods=['POST'], endpoint="delete_employee_info")
def delete_employee_info():
    return EmployeeResource.delete_employee_info()


@main_api.route("/delete_employee_info_list", methods=['POST'], endpoint="delete_employee_info_list")
def delete_employee_info_list():
    return EmployeeResource.delete_employee_info_list()


@main_api.route("/edit_employee_info", methods=['POST'], endpoint="edit_employee_info")
def edit_employee_info():
    return EmployeeResource.edit_employee_info()


@main_api.route("/get_employee_info_by_tags", methods=['GET'], endpoint="get_employee_info_by_tags")
def get_employee_info_by_tags():
    return EmployeeResource.get_employee_info_by_tags()


@main_api.route("/get_department_all_info", methods=['GET'], endpoint="get_department_all_info")
def get_department_all_info():
    return DepartmentResource.get_department_all_info()


@main_api.route("/add_department_info", methods=['POST'], endpoint="add_department_info")
def add_department_info():
    return DepartmentResource.add_department_info()


@main_api.route("/delete_department_info", methods=['POST'], endpoint="delete_department_info")
def delete_department_info():
    return DepartmentResource.delete_department_info()


@main_api.route("/delete_department_info_list", methods=['POST'], endpoint="delete_department_info_list")
def delete_department_info_list():
    return DepartmentResource.delete_department_info_list()


@main_api.route("/edit_department_info", methods=['POST'], endpoint="edit_department_info")
def edit_department_info():
    return DepartmentResource.edit_department_info()


@main_api.route("/get_department_info_by_tags", methods=['GET'], endpoint="get_department_info_by_tags")
def get_department_info_by_tags():
    return DepartmentResource.get_department_info_by_tags()


@main_api.route("/get_newspaper_all_info", methods=['GET'], endpoint="get_newspaper_all_info")
def get_newspaper_all_info():
    return NewspaperResource.get_newspaper_all_info()


@main_api.route("/add_newspaper_info", methods=['POST'], endpoint="add_newspaper_info")
def add_newspaper_info():
    return NewspaperResource.add_newspaper_info()


@main_api.route("/delete_newspaper_info", methods=['POST'], endpoint="delete_newspaper_info")
def delete_newspaper_info():
    return NewspaperResource.delete_newspaper_info()


@main_api.route("/delete_newspaper_info_list", methods=['POST'], endpoint="delete_newspaper_info_list")
def delete_newspaper_info_list():
    return NewspaperResource.delete_newspaper_info_list()


@main_api.route("/edit_newspaper_info", methods=['POST'], endpoint="edit_newspaper_info")
def edit_newspaper_info():
    return NewspaperResource.edit_newspaper_info()


@main_api.route("/get_newspaper_info_by_tags", methods=['GET'], endpoint="get_newspaper_info_by_tags")
def get_newspaper_info_by_tags():
    return NewspaperResource.get_newspaper_info_by_tags()


@main_api.route("/get_order_all_info", methods=['GET'], endpoint="get_order_all_info")
def get_order_all_info():
    return OrderResource.get_order_all_info()


@main_api.route("/add_department_order_info", methods=['POST'], endpoint="add_department_order_info")
def add_department_order_info():
    return OrderResource.add_department_order_info()


@main_api.route("/add_employee_order_info", methods=['POST'], endpoint="add_employee_order_info")
def add_employee_order_info():
    return OrderResource.add_employee_order_info()


@main_api.route("/delete_order_info_list", methods=['POST'], endpoint="delete_order_info_list")
def delete_order_info_list():
    return OrderResource.delete_order_info_list()


@main_api.route("/get_order_info_by_tags", methods=['GET'], endpoint="get_order_info_by_tags")
def get_order_info_by_tags():
    return OrderResource.get_order_info_by_tags()


@main_api.route("/edit_order_info", methods=['POST'], endpoint="edit_order_info")
def edit_order_info():
    return OrderResource.edit_order_info()


@main_api.route('/download')
def download():
    return download_file()


@main_api.route('/get_order_info_by_newspaper_ID', methods=['GET'], endpoint="get_order_info_by_newspaper_ID")
def get_order_info_by_newspaper_ID():
    return OrderResource.get_order_info_by_newspaper_ID()
